#include "temp_util.h"
#include "inc.h"
#include <fstream>
#include <iostream>
#include <sstream>

USING_NS_TEST;
USING_NS_STD;

TempUtil* elloop_test::TempUtil::run()
{
    write_url();
    return this;
}

void elloop_test::TempUtil::write_url()
{
    ifstream src;
    src.open("dir.txt", ios::in);

    ofstream dst;
    dst.open("url.txt", ios::out);

    string line_in("");
    string name("");
    string url_suffix("");
    string url_base("http://download.mxhzw.com/download/V2.1/Apks/channels/DreamOnePiece_2.1.0_youai_");
    if (dst.is_open() && src.is_open()) {
        while (getline(src, line_in))
        {
            stringstream ss(line_in);
            ss >> name >> url_suffix;
            dst << name << "\t\t\t\t\t" << (url_base + url_suffix + ".apk") << endl;
        }
        src.close();
        dst.close();
    }

    src.close();
    dst.close();
}

